package org.biubiu0002.baiblog.core.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

/**
 * @Author: biubiu0002
 * @Date: 2022/8/3 21:17
 **/
@Component
@Slf4j
public class MsgSendConfirmCallBack implements RabbitTemplate.ConfirmCallback {
    @Override
    public void confirm(CorrelationData correlationData, boolean ack, String s) {
        log.info("MsgSendConfirmCallBack  , 回调correlationData:" + correlationData);
        if (ack) {
            log.info("消息发送到exchange成功");
            // TODO 删除 msgId 与 Message 的关系
        } else {
            log.info("消息发送到exchange失败");
            // TODO 消息发送到exchange失败 ， 重新发送
        }

    }
}
